using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;


namespace DD.Visitors
{
    public class Visitor
    {
        public bool IsLoggedIn()
        {
            if (HttpContext.Current.Session["USERID"] != null && HttpContext.Current.Session["USERID"].ToString() != "")
            {
                return true;
            }
            else
            {
                return false;
            }
        }
      
        public int UserId
        {
            get
            {
                if (IsLoggedIn())
                {
                    return (Int32)HttpContext.Current.Session["USERID"];
                }
                else
                {
                    return -1;
                }
            }
        }

        public bool LoginUser(string username, string password)
        {
            return DD.Data.SQL.UserManager.LogUserIn(username, password);
        }

        public void LogoutUser()
        {
            HttpContext.Current.Session["USERID"] = null;

        }
    }

}
